<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
    <style>
        div{
            padding: 5px;
        }
        #mybtn {
            width: 100px;
            height: 30px;
            font-size: 18px;
            background-color: #00a0e9;
            border: none;
            text-align: center;
            color: #FFF;
        }
        #box{
            width: 300px;
            height: 300px;

            box-shadow: 0 0 1px 5px #fff;
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%,-50%);
            background: #fff;
        }
        #bg{
            width: 100vw;
            height: 100vh;
            position: absolute;
            left: 0;
            top: 0;
            background: rgba(0,0,0,.5);
        }
    </style>
</head>
<body>


<a href="#" class="btn" style="cursor:pointer">批量申报</a>
<div id="bg">
    <div id="box">
        文件:<input id="file" type="file" name="file"/>
        <button id="upload">上传文件</button>
        <div class="out">关闭</div>
    </div>
</div>
</body>
</html>
<script>
    $(function () {
        $("#upload").click(function(){
            var formData = new FormData();
            formData.append('file', $('#file')[0].files[0]);

            $.ajax({
                url: "/uploadFile/addUploadFileUrl",
                type: "POST",
                data: formData,
                /**
                 *必须false才会自动加上正确的Content-Type       应该是这个enctype="multipart/form-data"
                 */
                contentType: false,
                /**
                 * 必须false才会避开jQuery对 formdata 的默认处理
                 * XMLHttpRequest会对 formdata 进行正确的处理
                 */
                processData: false,
                success: function (data) {
                    alert("success");

                },
                error: function () {
                    alert("上传失败！");

                }
            });
        })
    });
</script>

<script>

    $('#bg').hide()
    $('#box').hide()
    $('.btn').click(function(){
        $('#bg').fadeIn('slow')
        $('#box').fadeIn('slow')
    })
    $('.out').click(function(){
        $('#bg').fadeOut('slow')
        $('#box').fadeOut('slow')
    })
</script>